/******************************************************************************
 * Copyright 2024 AutoX. All Rights Reserved.
 *****************************************************************************/

#include "common/mcu_log.h"
#include <stdarg.h>

namespace mcuagent {
int g_mcu_log_level = MCU_LOG_LEVEL_DEBUG;

void Mcu_Log_Set_Level(int level) {
    if (level >= MCU_LOG_LEVEL_DEBUG && level <= MCU_LOG_LEVEL_FATAL) {
        g_mcu_log_level = level;
    }
}


int Mcu_Log_Get_Level(void) {
    return g_mcu_log_level;
}


void Mcu_Log_writter(const char *file, const char *func, const int line, const int level, const char *fmt, ...) {
    if (level >= g_mcu_log_level) {
        va_list args;
        va_start(args, fmt);
        printf("[%s][%s][%d] ", file, func, line);
        vprintf(fmt, args);
        printf("\n");
        va_end(args);
    }

    return;
}
}  // namespace mcuagent
